export function formatLogStr (logStr) {
  if (logStr) {
    var log = logStr.split("\n");
    if (log.length > 0) {
      var sqlStr = log[0].substring(
        log[0].indexOf("Preparing:") > -1
          ? log[0].indexOf("Preparing:") + 10
          : 0
      );
      if(log.length > 1 && log[1]){
        var parm = log[1].substring(
          log[1].indexOf("Parameters:") > -1
            ? log[1].indexOf("Parameters:") + 11
            : 0
        );
        var sql = sqlStr.split("?");
        parm = parm.split(",");
        if (sql.length == parm.length + 1) {
          var res = sql[0];
          var stringTypes = ["String)", "Date)", "LocalDateTime)"];
          for (var i = 1; i < sql.length; i++) {
            var value = parm[i - 1].split("(")[0].trim();
            var type = parm[i - 1].split("(")[1].trim();
            if (stringTypes.indexOf(type) > -1) {
              res += "'" + value + "'";
            } else {
              res += value;
            }
  
            res += sql[i];
          }
          console.log(res);
          return res;
        }
      }
      return sqlStr;
    }
  }

  return ''
}
